﻿
using System;
using System.Data;
using System.Collections.Generic;

namespace JWFW.Model.Register.BRL
{
    #if Server
    /// <summary>
    /// 软件工具类
    /// </summary>
    public partial class Tool : BOL.BaseConfigEntity
    {
        /// <summary>
        /// 软件工具类
        /// </summary>
        public Tool()
        {
            m_tableName = "rem_tool";
            m_hasCode = true;
            m_hasComment = true;
            m_tblCacheManager.IsEnable = true;
        }

        protected string m_lastVersion = string.Empty;
        protected string m_url = string.Empty;
        protected string m_specialInfo = string.Empty;
        protected int m_tryDays = 3;
        protected bool m_clientValidate = false;
        protected string m_netInfo = string.Empty;
        protected bool m_changeMC = false;



        /// <summary>
        /// 最近版本号
        /// </summary>
        public string LastVersion
        {
            get { return m_lastVersion; }
            set { m_lastVersion = value; }
        }
        /// <summary>
        /// 当前版本下载地址
        /// </summary>
        public string Url
        {
            get { return m_url; }
            set { m_url = value; }
        }
        /// <summary>
        /// 客户端需要的特殊信息，如反射信息
        /// </summary>
        public string SpecialInfo
        {
            get { return m_specialInfo; }
            set { m_specialInfo = value; }
        }
        /// <summary>
        /// 试用时间
        /// </summary>
        public int TryDays
        {
            get { return m_tryDays; }
            set { m_tryDays = value; }
        }
        /// <summary>
        /// 是否是单机注册【非网络验证】
        /// </summary>
        public bool ClientValidate
        {
            get { return m_clientValidate; }
            set { m_clientValidate = value; }
        }

        /// <summary>
        /// 网络验证时客户端需要的额外特殊信息，第一位是随机数，以后是信息，按顺序排列，";"分割
        /// </summary>
        public string NetInfo
        {
            get { return m_netInfo; }
            set { m_netInfo = value; }
        }

        /// <summary>
        /// 此工具是否允许修改机器码：允许是当进行客户主动验证时会更新机器码，其他机器上则获取信息时失败，若不允许则，客户验证码不对时不能使用工具
        /// </summary>
        public bool ChangeMC
        {
            get { return m_changeMC; }
            set { m_changeMC = value; }
        }

        protected override void FillContainer()
        {
            base.FillContainer();
            m_container.Add("lastVersion", m_lastVersion);
            m_container.Add("url", m_url);
            m_container.Add("specialInfo", m_specialInfo);
            m_container.Add("tryDays", m_tryDays);
            m_container.Add("clientValidate", m_clientValidate);
            m_container.Add("netInfo", m_netInfo);
            m_container.Add("changeMC", m_changeMC);
        }

        public override bool GetProperties(System.Data.DataRow record)
        {
            if (!base.GetProperties(record))
            {
                return false;
            }
            m_lastVersion = this.GetStringValue(record, "lastVersion");
            m_url = this.GetStringValue(record, "url");
            m_specialInfo = this.GetStringValue(record, "specialInfo");
            m_tryDays = this.GetIntValue(record, "tryDays");
            m_clientValidate = this.GetBoolValue(record, "clientValidate");
            m_netInfo = this.GetStringValue(record, "netInfo");
            m_changeMC = this.GetBoolValue(record, "changeMC");
            return true;
        }
    }
#endif
}